<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
            String basePath = "http://" + request.getLocalAddr() + ":" + request.getLocalPort() + request.getContextPath();
%>
<html>
    <title>${promptInfo.totalDescInfo}</title>
    <head>
<script type="text/javascript">
var gridtb;
$(document).ready(function(){	
	$("#selectMenu").selectTB({	
		//传值元素ID
		valElementID:'select_default_value',	
		//显示元素ID
		textElementID:'select_default_text',	
		//下拉宽度
		selectWidth:'200',
		//下拉高度	
		selectHeight:'16',
		//树根描述
		rootName:'', 			
		primkeyColumn:'orgID',
		//要进行树型显示的列，支持一列
		selectShowColumn:'orgName',
		//树型下拉树列表，起始根值
		nodeStartValue:'${session.s_userOrgID}', 
		//描述树形菜单子列
		childNodeColumn:'orgID',
		//描述树形菜单父列
		parentNodeColumn:'orgParentID',	
    	//ajax 获取所有树json格式信息
    	ajax:{
			//ajax请求url
			url:'ajaxAction.action', 
			//ajax请求参数
			data:'code=${pmsIndex.sys_org_mgr.code}'
		}
	},{
	   animated:false
   }); 
	   
	var ujdata = {
		    globalParam:$("#actionForm").formSerialize(),
		    //type ：first,last
		    //order ：a(升序),d(降序)
	    	//serialno:{name:'编号',type:'first',width:'10%',order:'a'},			    
		    //first,last
	    	checkbox:{name:'全选',type:'first',width:'10%'},
	    	shortcut:{
	    		name:'操作',
		    	url:'decorateForwardAction.action',
		    	width:'50%',
		    	event:[
	    			{operate:'modify',name:'${pmsIndex.sys_user_modify.name}',disabled:'false',isvalid:'${!empty pmsIndex.sys_user_modify}',param:'code=${pmsIndex.sys_user_modify.code}'},
       				{operate:'del',name:'${pmsIndex.sys_user_delete.name}',disabled:'false',isvalid:'${!empty pmsIndex.sys_user_delete}',param:'code=${pmsIndex.sys_user_delete.code}'},
       				{operate:'detail',name:'${pmsIndex.sys_user_detail.name}',disabled:'false',isvalid:'${!empty pmsIndex.sys_user_detail}',param:'code=${pmsIndex.sys_user_detail.code}'},
       				{operate:'detail',name:'${pmsIndex.sys_user_modify_pwd.name}',disabled:'false',isvalid:'${!empty pmsIndex.sys_user_modify_pwd}',param:'code=${pmsIndex.sys_user_modify_pwd.code}'},
       				{operate:'bind',name:'${pmsIndex.sys_user_bind.name}',disabled:'false',isvalid:'${!empty pmsIndex.sys_user_bind}',param:'code=${pmsIndex.sys_user_bind.code}'}
		        ]
		    },
	    	columnDesc:{
		    	//列表要显示的列（在json中对应的key）
				showColumn: ['ORG_NAME','userName','userAccount'],
				//列表头显示名称
				columnName:   ['所属机构','用户姓名','用户账号'],
				//列表头宽度
				columnWidth:   ['13%','13%','13%'],
				//可以作为主键的类，在页面传送的过程中为paramMap.orgID=value的形式
				//多个主键的时候为["orgID","orgCode"]:paramMap.orgID=value&paramMap.orgCode=value
				primkeyColumn:["userID"],
				//要增加链接的列，可以为多个
				linkColumn:[{name:'',url:'',param:''}]
	    	},		
	    	ajax:{
	        	url:'ajaxAction.action',
	        	data:'code=${code}'
		    },
		    //是否有分页工具条
		    isPagination:'true',	    
	    	paginationData:{
				pageSize:'10'
	    	}		    		 
		};
	var ujoption = {
			autoclose: true,
			columnAlias:function(col,val){
				if(col == 'userGender')
				{
					if (val == '1')
						val = "男";
					else if (val == '0')
						val =  "女";
				}
				return val;
			},
			extendDrawShortcut:function(key){
				return '';
			}
		};
	    $('#grid').gridTB(ujdata,ujoption);
        $("#search_user").click(function(){
        	ujdata = $.extend(ujdata,{globalParam:$("#actionForm").formSerialize()})
        	$('#grid').gridTB(ujdata,ujoption);
         });

        $('#delete_user').screenTB({
        	windowDocument:window.parent.document,
    		width:'250',
    		height:'150',
    		content:'测试内容',
    		contentAlign:'center',
    		contentValign:'middle',
    		title:'系统提示信息',
			buttonValueYes:'确定',	
			buttonValueNo:'取消',	
			dialogType:'alert',
			iframeSrc:''
    		},{
    		clickEvent:function(data){
	    			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
	    				data = $.extend(data,{content:'请选择您要删除的用户！'});
	    				return false;
	    			}
	    			else{
	    				var userID="";
	    				$("#grid tbody input[type='checkbox']:checked").each(function(){
	                        userID+=$(this).val()+",";
	    				})
	    				userID = userID.substring(0,userID.length-1);
	    				window.location.href = "decorateForwardAction.action?code=${pmsIndex.sys_user_delete.code}&paramMap.userID="+userID;
	    				return true;
	    			}
    			}
    		});
});
</script>
</head>
<body>
<form name="actionForm" method="post" action="decorateForwardAction.action?code=${pmsIndex.sys_user_search.code}" id="actionForm">
<input type="hidden" name="hid_orgCode" id="hid_orgCode" value="${S_OrgCode}">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableC">
	<tr>
	   <td class="tableCleft">&nbsp;</td>
	   <td class="tableCcenter">
		      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="SkyTDLine">
		         <tr>
		          <td class="SkyTDLine">
		            <table width="100%" border="0" cellpadding="0" cellspacing="1" class="SkyTableLine">
		             <tr align="center" class="MeNewTDLine">
		               <td align="right" class="SkyTDLine" width="10%">&nbsp;所属机构：</td>
						<td align="left" class="SkyTDLine" width="30%" style="padding:1px 0 1px 6px;">
						    <div id="selectMenu">
							<input type="hidden"  id="select_default_value" name="searchMap.select_default_value">
						    <input type="hidden" id="select_default_text" name="searchMap.select_default_text">
							</div>		
						</td>
						<td align="right" class="SkyTDLine" width="10%">&nbsp;用户账号：</td>
						<td align="left" class="SkyTDLine" width="30%">
						&nbsp;&nbsp;<input type="text" name="searchMap.userAccount" id="userAccount" style="width: 200;" />
						</td>
						<td align="center" rowspan="2" class="SkyTDLine" width="20%">
							<s:if test="pmsIndex.sys_user_search">
							<a href="#" id="search_user"><img src="<%=request.getContextPath()%>/${pmsIndex.sys_user_search.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.sys_user_search.name}</a>
							</s:if>
						</td>
					 </tr>
		               <tr align="center" class="MeNewTDLine">
						<td align="right" class="SkyTDLine" width="10%">&nbsp;用户姓名：</td>
						<td align="left" class="SkyTDLine" width="30%">
						 &nbsp;&nbsp;<input type="text" name="searchMap.name" id="name" style="width: 200;" />
						</td>
						<td align="right" class="SkyTDLine" width="10%">&nbsp;用户分机：</td>
						<td align="left" class="SkyTDLine" width="30%">
						 &nbsp;&nbsp;<input type="text" name="searchMap.userExtPhone" id="userExtPhone" style="width: 200;" />
		                </td>
		               </tr>
		              </table>
		            </td>
		         </tr>
		      </table>
	     </td>
	     <td class="tableCright">&nbsp;</td>
	   </tr>
	   <tr>
	    <td class="tableCleft">&nbsp;</td>
	    <td class="tableCcenter" align="right">
		    <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="SkyTableLine">
	          <tr>
	            <td class="SkyTDLine" align="right" style="background:#9CC7FF;height:22;" >
					<s:if test="pmsIndex.sys_user_create">
					<a href="decorateForwardAction.action?code=${pmsIndex.sys_user_create.code}"><img src="<%=request.getContextPath()%>/${pmsIndex.sys_user_create.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.sys_user_create.name}</a>
					</s:if>
					<s:if test="pmsIndex.sys_user_delete">
					<a id="delete_user" href="#"><img src="<%=request.getContextPath()%>/${pmsIndex.sys_user_delete.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.sys_user_delete.name}</a>
					</s:if>
			     </td>
	            </tr>
	          </table>                         
	       </td>
	      <td class="tableCright">&nbsp;</td>
	    </tr>
	    <tr>
	        <td class="tableCleft">&nbsp;</td>
	        <td class="tableCcenter">
	            <table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" class="SkyTDLine">
	                <tr>
	                    <td valign="top" id="grid" class="MeNewTDLine">
	                     &nbsp;
	                    </td>
	                </tr>
	            </table>
	        </td>
	        <td class="tableCright">&nbsp;</td>
	    </tr>
	</table>
</form>
</body>
</html>
